/***********************************************************************************File        : Table3_stern_menzies.do Authors     : Ariel Dora Stern & Nick MenziesCreated     : 25 Apr 2010Modified    : 26 Apr 2010Description : Compile DHS Data for Gov 2001 Paper***********************************************************************************/set mem 800m
cd "/Users/Ariel/Dropbox/Gov2001"
set more off

use "all_small_cleaned_HIVonly.dta", clear

*linear model:

/****************************************************
THE BASIC REGRESSIO IS OF THE FORM:
	
regress hiv educ urban ///
	married was_married widow ///
	mult_mar polyg protestant ///
	muslim oth_relig  toilet ///
	efloor electr refrig eth* reg* age* ///
	[pweight= sweight_new]  if female==1 & country==1, vce(cluster cluster)

...which we abbreviate with a macro in our data since all regressios have the same RHS
******************************************************/
label var hiv "HIV Positive"
label var educ "Years of Education"
label var urban "Urban Resident"
label var married "Married"
label var was_married "Formerly Married"
label var widow "Widowed"
label var mult_mar "Multiple Marriages"
label var polyg "Polygamous" 
label var protestant "Protestant"
label var muslim "Muslim"
label var efloor "Earth Floor"


global reg = "hiv educ urban married was_married widow mult_mar polyg protestant muslim efloor toilet electr refrig eth* reg* age*"
global weights = "[pweight= sweight_new]"
global ivreg = "hiv educ urban married was_married widow mult_mar polyg protestant muslim (efloor = toilet electr refrig tv bike motorc car) eth* reg* age*"

global pout ="outreg educ urban married was_married widow mult_mar polyg protestant muslim efloor using probit.out, se bracket append"
global ivout ="outreg educ urban married was_married widow mult_mar polyg protestant muslim efloor using ivtable.out, se bracket append"

***********
* BURKINA *
***********

regress $reg $weights if female ==0 & country ==1, vce(cluster cluster)
*outtex, title(TITLE HERE) file(Table1) level digits(4) replace 
regress $reg $weights if female ==1 & country ==1, vce(cluster cluster)
*outtex, title(TITLE) file(table1) level digits(4) append

dprobit $reg $weights if female ==0 & country ==1, vce(cluster cluster)
*mfx
outreg ///
	educ urban married was_married widow mult_mar polyg protestant muslim efloor ///
	using probit.out, se bracket replace
dprobit $reg $weights if female ==1 & country ==1, vce(cluster cluster)
*mfx
$pout
	
ivreg $ivreg $weights if female ==0 & country ==1, vce(cluster cluster)
outreg ///
	educ urban married was_married widow mult_mar polyg protestant muslim efloor ///
	using ivtable.out, se bracket replace
ivreg $ivreg $weights if female ==1 & country ==1, vce(cluster cluster)
$ivout
	

************
* CAMEROON *
************

*regress $reg $weights if female ==0 & country ==2, vce(cluster cluster)
*regress $reg $weights if female ==1 & country ==2, vce(cluster cluster)

dprobit $reg $weights if female ==0 & country ==2, vce(cluster cluster)
*mfx
$pout
dprobit $reg $weights if female ==1 & country ==2, vce(cluster cluster)
*mfx
$pout

ivreg $ivreg $weights if female ==0 & country ==2, vce(cluster cluster)
$ivout
ivreg $ivreg $weights if female ==1 & country ==2, vce(cluster cluster)
$ivout

************
* GHANA *
************

*regress $reg $weights if female ==0 & country ==3, vce(cluster cluster)
*regress $reg $weights if female ==1 & country ==3, vce(cluster cluster)

dprobit $reg $weights if female ==0 & country ==3, vce(cluster cluster)
*mfx
$pout
dprobit $reg $weights if female ==1 & country ==3, vce(cluster cluster)
*mfx
$pout

ivreg $ivreg $weights if female ==0 & country ==3, vce(cluster cluster)
$ivout
ivreg $ivreg $weights if female ==1 & country ==3, vce(cluster cluster)
$ivout

************
* KENYA *
************

regress $reg $weights if female ==0 & country ==4, vce(cluster cluster)
regress $reg $weights if female ==1 & country ==4, vce(cluster cluster)

dprobit $reg $weights if female ==0 & country ==4, vce(cluster cluster)
*mfx
$pout
dprobit $reg $weights if female ==1 & country ==4, vce(cluster cluster)
*mfx
$pout

ivreg $ivreg $weights if female ==0 & country ==4, vce(cluster cluster)
$ivout
ivreg $ivreg $weights if female ==1 & country ==4, vce(cluster cluster)
$ivout

************
* TANZANIA *
************

global treg = "hiv educ urban married polyg protestant muslim oth_relig toilet efloor electr refrig eth* reg* age*"
global tivreg = "hiv educ urban married polyg protestant muslim oth_relig (efloor = toilet electr refrig tv bike motorc car) eth* reg* age*"

global tpout ="outreg educ urban married polyg protestant muslim efloor using probit.out, se bracket append"
global tivout ="outreg educ urban married polyg protestant muslim efloor using ivtable.out, se bracket append"

*regress $treg $weights if female ==0 & country ==5, vce(cluster cluster)
*regress $treg $weights if female ==1 & country ==5, vce(cluster cluster)

dprobit $treg $weights if female ==0 & country ==5, vce(cluster cluster)
*mfx
$tpout
dprobit $treg $weights if female ==1 & country ==5, vce(cluster cluster)
*mfx
$tpout

ivreg $tivreg $weights if female ==0 & country ==5, vce(cluster cluster)
$tivout
ivreg $tivreg $weights if female ==1 & country ==5, vce(cluster cluster)
$tivout

**POOLED***

ivreg $tivreg $weights if female ==0, vce(cluster cluster)
$tivout
ivreg $tivreg $weights if female ==1, vce(cluster cluster)
$tivout
ivreg $tivreg $weights, vce(cluster cluster)
$tivout

dprobit $treg $weights if female ==0, vce(cluster cluster)
$tpout
dprobit $treg $weights if female ==1, vce(cluster cluster)
$tpout
dprobit $treg $weights, vce(cluster cluster)
$tpout


